﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class frm_HeaderPage : System.Web.UI.Page
{
    private void ShowMessage()
    {
        ClsPropertyDAL cls_Property = new ClsPropertyDAL();

        string strUserID = cls_Property.SetOrGetUserID;

        if (strUserID != "")
        {
            if (!IsPostBack)
            {
                this.lblCurrUser.Text = strUserID;
            }
            else
            {
                this.lblJs.Text = "";
            }
        }
        else
        {
            this.Page.Session.Remove("SetOrGetUserID");
            this.lblJs.Text = "<script>parent.window.location.href='index.aspx'</script>";
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.ShowMessage();
        }

        this.ibtnLogOut.Attributes.Add("onClick", "return confirm('您真的要注销当前用户吗？');");
        this.ibtnExit.Attributes.Add("onClick", "return confirm('您真的要退出系统吗？');");

    }

    protected void ibtnLogOut_Click(object sender, ImageClickEventArgs e)
    {
        ClsPropertyDAL cls_Property = new ClsPropertyDAL();

        cls_Property.SetOrGetUserID = "";

        this.Page.Session.Remove("SetOrGetUserID");
        this.lblJs.Text = "<script>parent.window.location.href='index.aspx'</script>";
    }

    protected void ibtnExit_Click(object sender, ImageClickEventArgs e)
    {
        ClsPropertyDAL cls_Property = new ClsPropertyDAL();

        cls_Property.SetOrGetUserID = "";

        this.Page.Session.Remove("SetOrGetUserID");
        this.lblJs.Text ="<script>parent.window.close()</script>";
    }
}
